package cn.dianhun.om.jpa.controller;

import cn.dianhun.om.jpa.pojo.SysMenuEntity;
import cn.dianhun.om.jpa.repository.MenuDao;
import cn.dianhun.om.jpa.utills.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author cyt
 * @create 2020-07-08 17:24
 */

@RestController
@RequestMapping("/api")
public class testQueryController {

    @Autowired
    private MenuDao menuDao;

    /**
     * 使用 @ query 查询所有
     *
     * @return
     */
    @ApiOperation("使用 @ query 查询所有")
    @GetMapping("/testQuery")
    public R testQuery() {
        List<SysMenuEntity> menuEntities = menuDao.getAll();
        return R.ok().data("list", menuEntities);
    }
}
